package scripts;
import bot.ScriptMethods;

public class AFK extends ScriptMethods implements Runnable {

	private int[] foodIDs = { 350, 352, 362, 364, 367, 370, 373, 546, 555, 551,
			553, 355, 359, 357, 326, 327, 328, 329, 330, 332, 334, 335, 336,
			337, 750, 346, 249, 257, 258, 259, 261, 262, 263, 210 };

	public void start() {
		System.gc();
		getAccountSettings();

		scriptRunning = true;
		scriptThread = new Thread(this);
		scriptThread.start();
	}

	public void stop() {
		System.gc();
		scriptRunning = false;
		scriptThread = null;
		debug("Stopped script.");
	}

	public void run() {
		while (scriptRunning) {
			try {
				if (welcomeBoxOpen())
					setWelcomeBox();
				if (!isLoggedIn())
					doLogin();
				if (getFatigue() > 99 && !isSleeping()) {
					wait(600);
					useItem(1263);
					wait(600);
				}
				if (getFatigueSleeping() < 10 && isSleeping()) {
					doSleeping();
				}
				if (getFightMode() != fightMode) {
					setFightMode();
					wait(600);
				}
				wait(150);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}